<%@ taglib prefix="s" uri="/struts-tags"%> 
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<html>
<head>
 	   <link href="../../../css/Public.css"type="text/css" rel="stylesheet" />
       <link href="../../../css/PublicEdit.css"type="text/css" rel="stylesheet" /> 
        <SCRIPT type="text/javascript" src="/js/address.js"></SCRIPT>
<title>修改商家 </title>
<script>
			function checkData()
			{
					var merinfo_ksFullName= window.document.getElementById("merinfo_ksFullName").value;	
			        if(merinfo_ksFullName!=null && merinfo_ksFullName!="")
			        {		
			        	//限制 字符和数字、长度
			        	if(merinfo_ksFullName.length>15)
			        	{
			        	 	alert("中文名过长，最长15位！");
			        	 	window.document.getElementById("merinfo_ksFullName").focus();
			           		window.event.returnValue = false;
			            	return;
			        	}	  
			        }
			        else
			        {            
			            alert("请输入中文名！");
			            window.event.returnValue = false;
			            return;
			        }		
				    //验证数据   新用户名称
				    var mno=window.document.getElementById("merinfo_ksMerNo").value;
					var uname= window.document.getElementById("merinfo_mername").value;	
			        if(uname!=null && uname!="")
			        {			
			      	  //限制 字符和数字、长度
			        	if(uname.length>15)
			        	{
			        	 	alert("用户名过长，最长15位！");
			           		window.event.returnValue = false;
			            	return;
			        	}	  
			        	<c:forEach var="blist" items="${list_MerInfo}">	
			 			 if(uname=="${blist.merName}"&& mno!="${blist.ksMerNo}")
			 			 {
			     			 alert("该用户名已经存在");
			     			 document.getElementById("merinfo_ksMerNo").focus();
			     			 window.event.returnValue = false;
				  			 return;
					  	}		
        			  	</c:forEach>	       		
			        }
			        else
			        {            
			            alert("请输入用户名称！");
			            window.event.returnValue = false;
			            return;
			        }		
			        			
		 			//验证数据   密码
					var merinfo_ksPwd= window.document.getElementById("merinfo_ksPwd").value;	
			        if(merinfo_ksPwd!=null && merinfo_ksPwd!="")
			        {		
			       		if(merinfo_ksPwd.length>18||merinfo_ksPwd.length<6)
			        	{
			        	 	alert("用户密码长度为6-18位！");
			           	 	window.event.returnValue = false;
			            	return;
			        	}	    	       		
			        }
			        else
			        {            
			            alert("请输入密码！");
			             window.event.returnValue = false;
			             return;
			        }		
			          
			          //商务编号不能重复			
			        var merinfo_ksMerNo=window.document.getElementById("merinfo_ksMerNo").value;			        
        			if(merinfo_ksMerNo!=null && merinfo_ksMerNo!="")
			        {		
			        	//限制 字符和数字、长度
			        	if(merinfo_ksMerNo.length>15)
			        	{
			        	 	alert("客户编号或商务编号长度过长，最长15位！");
			        	 	window.document.getElementById("merinfo_ksMerNo").focus();
			           	 	window.event.returnValue = false;
			            	return;
			        	}	
			        	 <c:forEach var="blist" items="${list_MerInfo}">				         
			         	if(merinfo_ksMerNo=="${blist.ksMerNo}")
			 			 {
			     			 alert("该客户编号或商务编号已经存在！");
			     			 window.document.getElementById("merinfo_ksMerNo").focus();
			     			 window.event.returnValue = false;
				  			 return;
					  	}		  
        			  </c:forEach>	  
			        }		
        			var merinfo_ksMerRemark=window.document.getElementById("merinfo_ksMerRemark").value;			        
        			if(merinfo_ksMerRemark!=null && merinfo_ksMerRemark!="")
			        {		
			        	//限制 字符和数字、长度
			        	if(merinfo_ksMerRemark.length>100)
			        	{
			        	 	alert("商务人员备注过长，最长100！");
			        	 	window.document.getElementById("merinfo_ksMerRemark").focus();
			           	 	window.event.returnValue = false;
			            	return;
			        	}	  
			        }		
			        //电话长度限制
        			var merinfo_ksMerPhone=window.document.getElementById("merinfo_ksMerPhone").value;			        
        			if(merinfo_ksMerPhone!=null && merinfo_ksMerPhone!="")
			        {		
			        	//限制 字符和数字、长度
			        	if(merinfo_ksMerPhone.length>11)
			        	{
			        	 	alert("商务电话过长，最长11！");
			        	 	window.document.getElementById("merinfo_ksMerPhone").focus();
			           	 	window.event.returnValue = false;
			            	return;
			        	}	  
			        }			      
			}	
 </script>		
</head>
<body onload="javascript:loadData('pro','city','area');">
<form action="/admin/merchant/editmer?uiid=${param.username}&pno=${pno}" method="post" enctype="multipart/form-data">
 <input type="hidden" id="merinfo_ksMerNo" name="merinfo_ksMerNo" value="${merRegist.ksMerNo}"/>
  <input type="hidden" id="merinfo_ksCreateTime" name="merinfo_ksCreateTime" value="${merRegist.ksCreateTime}"/>
				<div>
		                <div class="l_f_top">
		                    <div class="l_f_top_left_div"><img alt="" src="../../../images/tb.gif" width="16" height="16" /></div>
		                    <div class="l_f_top_right_div">修改商家      </div>
		                </div>
		                <div class="l_f_body"> 
		                 <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            商家全称:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="merinfo_ksFullName" id="merinfo_ksFullName" value="${merRegist.ksFullName}" style="width:120px"/>  
					           </div>                      
		                    </div>	  			                    
		      			  <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            商家用户名:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="merinfo_mername" id="merinfo_mername" value="${merRegist.merName}" style="width:120px"/>  
					           </div>                      
		                    </div>	 
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                              密码:</div>
		                        <div class="l_f_body_div5" >
		               		      <input type="password"  name ="merinfo_ksPwd" id="merinfo_ksPwd" value="${merRegist.ksPwd}" style="width:120px"/>  
							   </div>
		                    </div>
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            商家编号:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="merinfo_ksMerNo" id="merinfo_ksMerNo" value="${merRegist.ksMerNo}" style="width:120px"/>  
					           </div>                      
		                    </div>	
		                    <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                              用户组:</div>
		                        <div class="l_f_body_div5" >
		               		     <select name="merinfo_ksMerGroup" id="merinfo_ksMerGroup" style="width: 120px">	
										<c:if test="${merRegist.ksMerGroup==1}"><option value=1 selected>普通人员</option><option value="2">运营人员</option><option value="3">管理人员</option><option value="4">系统配置人员</option>	</c:if>
		          						<c:if test="${merRegist.ksMerGroup==2}"><option value=1 >普通人员</option><option value="2" selected>运营人员</option><option value="3">管理人员</option><option value="4">系统配置人员</option>	</c:if>	
										<c:if test="${merRegist.ksMerGroup==3}"><option value=1 >普通人员</option><option value="2" >运营人员</option><option value="3" selected>管理人员</option><option value="4">系统配置人员</option>	</c:if>
										<c:if test="${merRegist.ksMerGroup==4}"><option value=1 >普通人员</option><option value="2" >运营人员</option><option value="3">管理人员</option><option value="4" selected="selected">系统配置人员</option>	</c:if>
																												
								</select>
							   </div>
							    <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            商家地址:</div>
		                        <div class="l_f_body_div5">
				                       <table>
									  <tr>
									  	<td>省</td><td><select id="pro" name="pro" onchange="javascript:chProvance('pro','city','area')"></select></td>
									  	<td>市</td><td><select id="city" name="selcity" onchange="javascript:chCity('city','area')"></select></td>
									  	<td>区</td><td><select id="area" name="area"></select></td>
									  	</tr>
									  	</table>  
					           </div>                 
					            <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                              详细地址:</div>
		                        <div class="l_f_body_div5" >
		                       		 <textarea rows="3" cols="30" name ="merinfo_ksDetailAdd" id="merinfo_ksDetailAdd">${merRegist.ksMerAddress}</textarea><SPAN>(不用写省市区)</SPAN>
		                        </div>
		                    </div>     
		                    </div>	
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            商家电话:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="merinfo_ksMerPhone" id="merinfo_ksMerPhone" value="${merRegist.ksMerPhone}" style="width:120px"/>  
					           </div>                      
		                    </div>	
		                    </div>
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            备注:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="merinfo_ksMerRemark" id="merinfo_ksMerRemark"  style="width:360px" value="${merRegist.remark}"/> 
				                 </div>   
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                              用户状态:</div>
		                        <div class="l_f_body_div5" >
		               		     <select name="merinfo_ksMerStatus" id="merinfo_ksMerStatus" style="width: 120px">									
										<c:if test="${merRegist.ksMerStatus==0}"><option value="0" selected>冻结</option><option value="1"  >推荐</option><option value="2"  >后置</option><option value="3"  >正常</option></c:if>
		          						<c:if test="${merRegist.ksMerStatus==1}"><option value="0">冻结</option><option value="1" selected>推荐</option><option value="2"  >后置</option><option value="3"  >正常</option></c:if>
		          						<c:if test="${merRegist.ksMerStatus==2}"><option value="0">冻结</option><option value="1" >推荐</option><option value="2" selected >后置</option><option value="3"  >正常</option></c:if>
		          						<c:if test="${merRegist.ksMerStatus==3}"><option value="0">冻结</option><option value="1" >推荐</option><option value="2"  >后置</option><option value="3" selected >正常</option></c:if>
		          				</select>
							   </div>
		                    </div>		                    
		                    
		                     <div class="center l_f_body_foot">			                     
		                       <input type="submit" id="button" name="button" class="button2_60" onclick="checkData();"  value="提交"/>		                      
		                     <input type="button" class="button2_60"  onclick="javascript:history.go(-1);" value=" 返回"/> 
		                  </div>
		                </div>
			    	</div> 
			   </div>
</form>
</body>
</html>